<template>
	<div>
		<el-form ref="form" :model="form" label-width="100px">



			<el-form-item label="姓名" prop="customerName">
				<el-input v-model="form.customerName"></el-input>
			</el-form-item>


			<el-form-item label="性别" prop="customerSex">
				<el-select v-model="form.customerSex">
					<el-option v-for="(item,index) in sexData" :key="index" :value="item.value" :label="item.label"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="家属姓名" prop="familyName">
				<el-input v-model="form.familyName"></el-input>
			</el-form-item>
			<el-form-item label="家属电话" prop="familyTel">
				<el-input v-model="form.familyTel"></el-input>
			</el-form-item>
			<el-form-item label="事项" prop="items">
				<el-input v-model="form.items"></el-input>
			</el-form-item>
			<el-form-item label="发现人" prop="discoverer">
				<el-input v-model="form.discoverer"></el-input>
			</el-form-item>
			<el-form-item label="处置结果" prop="actionResults">
				<el-input v-model="form.actionResults"></el-input>
			</el-form-item>
			<el-form-item label="备注" prop="comment">
				<el-input v-model="form.comment"></el-input>
			</el-form-item>
			<el-form-item label="通知人" prop="notifier">
				<el-input v-model="form.notifier"></el-input>
			</el-form-item>
			<el-form-item label="通知时间" prop="notificationTime">
				<el-date-picker v-model="form.notificationTime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" :style="{width: '100%'}"
				 placeholder="请输入时间" clearable>
				</el-date-picker>
			</el-form-item>
		

			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>

<script>
	export default {
		customerName: 'EmergencyManagementEdit',
		components: {

		},
		props: [
			'showEdit',
			'managementId',
			'editid'
		],
		data() {
			return {
				form: {
					managementId:'',
					customerName: '',
					customerSex: '',
					familyName: '',
					familyTel: '',
					createTime: '',
					items: '',
					discoverer: '',
					actionResults: '',
					comment: '',
					notifier: '',
					notificationTime: ''
					
				},
				sexData: [{
					"label": "男",
					"value": "男"
				}, {
					"label": "女",
					"value": "女"
				}],
				// supdate: false,
				url: '/emergencyManagement/save',
				registerlevel: [],
				depts: [],
			}
		},
		created() {
			// this.init()
			console.log("this.editid:" + this.editid)
			if (this.editid) {
				this.axios.get('/emergencyManagement/toedit', response => {
					console.log(response.obj);
					this.form=response.obj
					this.url='/emergencyManagement/update'
				}, {
					id: this.editid
				})
			}
		},
		methods: {
			save() {
				this.$refs['form'].validate((valid) => {
					if (valid) {
						this.axios.post(this.url, response => {
							// 子组件要改变父组件的值
							this.$emit('update:show', false)
							this.$emit('getData')
						}, this.form)
					}
				})
			}

		}
	}
</script>

<style>
</style>
